package com.ywy.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.ServletRequestUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * <p>
 * 博客分类 前端控制器
 * </p>
 *
 * @author ywy
 * @since 2021-12-24
 */
@Controller
@RequestMapping("/category")
public class CategoryController extends BaseController {
    /**
     * 博客分类
     * @param id
     * @return
     */
    @GetMapping("/{id:\\d*}")
    public String category(@PathVariable Integer id) {
        // 记录当前分类id
        req.setAttribute("currentCategoryId", id);
        req.setAttribute("currentPn", getPage().getCurrent());
        int typeId = ServletRequestUtils.getIntParameter(req, "typeId", 0);
        int orderId = ServletRequestUtils.getIntParameter(req, "orderId", 0);
        req.setAttribute("typeId", typeId);
        req.setAttribute("orderId", orderId);
        return "post/category";
    }
}
